<?php


use Illuminate\Foundation\Testing\RefreshDatabase;
use Laravel\Passport\ClientRepository;
use Modules\Admin\Entities\Admin;
use Modules\Auth\Services\TokenService;
use Tests\TestCase;

class TokenServiceTest extends TestCase {
    use RefreshDatabase;

//    use DatabaseTransactions;
    public function testLogout() {
        /** @var Admin $admin */
        $admin = Admin::factory()->create();
        $clientRepository = new ClientRepository();
        $client = $clientRepository->createPersonalAccessClient(
            null,
            'Test Personal Access Client',
            'http://localhost'
        );
//        $client = $clientRepository->createPasswordGrantClient(
//            null, 'admin', 'http://localhost'
//        );
//       dump(
//           DB::table('oauth_clients')->get()->toArray(),DB::table('oauth_personal_access_clients')->get()->toArray());
//       dd(\Laravel\Passport\PersonalAccessClient::all()->toArray());
//        $admin->createToken('admin')->accessToken;
//        dd($admin->createToken('admin')->accessToken);
        TokenService::getInstance()->logout($admin);
    }

    protected function setUp(): void {
        parent::setUp(); // TODO: Change the autogenerated stub
    }
}
